package IO;

import java.io.*;
import java.util.Enumeration;
import java.util.Vector;

/**
 * @author wuhan
 * @date 2019/10/12 14:25
 */
public class SequenceInputStreamDemo {
    public static void main(String[] args) throws IOException {
        Vector<FileInputStream> v=new Vector<>();
        v.add(new FileInputStream("a.txt"));
        v.add(new FileInputStream("buf.txt"));
        v.add(new FileInputStream("out.txt"));
        Enumeration<FileInputStream> elements = v.elements();
        SequenceInputStream sis=new SequenceInputStream(elements);
        FileOutputStream fos= new FileOutputStream("Onut.txt");
        byte[] buf=new byte[1024];
        int len=0;
        while ((len=sis.read(buf))!=-1){
            fos.write(buf,0,len);
        }
        fos.close();
        sis.close();
    }
}
